var express=require('express')
var Router=express.Router()
//检测token 及其他规则
var checkToken=require('../../tools/checkToken/index.js')
//解析用户信息
var getUserInfo=require('../../tools/NameList/index.js')

//增删改
var append=require('./append.js')
var drop=require('./drop.js')
var modify=require('./modify.js')

Router.use('/sets', async (req,res,next)=>{
	var isAddress=await checkToken(req);
	var userinfo=getUserInfo(req)
	req.userinfo=userinfo
	if(isAddress){
		switch(req.path){
			case '/append':
					append(req,res);
					break;
			case '/drop':
					drop(req,res);
					break;
			case '/modify':
					modify(req,res);
					break;
		}
	}else{
		res.send('token=>no')
	}
})

module.exports=Router;

